import 'package:flutter/material.dart';

class ParkEnterprises extends StatefulWidget {
  //final List<enterprises> allEnterprises;

  @override
  _ParkEnterprisesState createState() => _ParkEnterprisesState();
}

class _ParkEnterprisesState extends State<ParkEnterprises>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(vsync: this);
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('园区企业'),
      ),
      body: _buildGridView(),
    );
  }
}

Widget _buildGridView() {

  return new GridView.count(
    crossAxisCount: 2,
    padding: EdgeInsets.only(right: 16),
    children: getWidgetList(),
    crossAxisSpacing: 0,
    mainAxisSpacing: 0,
    // childAspectRatio: 1.1,
  );
}

List<List> getDataList() {
  List<List> list = [];
  for (int i = 0; i < 10; i++) {
    list.add([
      {
        'url':'https://static.86links.com/links86_img/6397692715798106112?Expires=1840688806&OSSAccessKeyId=EiDq8wkavjZS36mW&Signature=aZTGwLuU58oSnaQs%2BypTbm9ec2w%3D',
        'title': '园区名字'
      }
    ]);
  }
  return list;
}

List<Widget> getWidgetList() {
  return getDataList().map((item) => getWridViewItemUI(item)).toList();
}

Widget getWridViewItemUI(List item) {
  return Column(
    mainAxisAlignment: MainAxisAlignment.start,
    crossAxisAlignment: CrossAxisAlignment.start,
    children: <Widget>[
      Container(
        color: Colors.white,
        padding: EdgeInsets.only(left: 16.0, top: 16.0, bottom: 0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: double.infinity,
              child: Column(
                children: <Widget>[
                 
                  Image.network(
                      'https://static.86links.com/links86_img/6397692715798106112?Expires=1840688806&OSSAccessKeyId=EiDq8wkavjZS36mW&Signature=aZTGwLuU58oSnaQs%2BypTbm9ec2w%3D',
                      fit: BoxFit.contain,
                      // width: double.infinity,
                      height: 130,
                      // color: Colors.green,
                      ),
                ],
  
              ),
              decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border.all(color: Color(0xffecf0f1), width: 1),
                  borderRadius: BorderRadius.circular(4.0)
                  ),
            ),
            SizedBox(
              height: 8.0,
            ),
            Text(
              '大华为牛逼了',
              style: TextStyle(
                  fontSize: 12.0,
                  color: Color(0xff404040),
                  fontWeight: FontWeight.bold),
            ),
          ],
        ),
      ),
    ],
  );
}
